<template>
	<view class="fgpassword">
		<!-- #ifdef APP-PLUS -->
		<Hearder :name="'忘记密码'" v-if="type==1"></Hearder>
		<Hearder :name="'修改密码'" v-if="type==2"></Hearder>
		<!-- #endif -->
		<view class="content">
			<view class="itemList">
				<view>新密码</view>
				<input type="password" placeholder="请输入密码" placeholder-style="color:#999" v-model="password"/>
			</view>
			<view class="itemList">
				<view>重复密码</view>
				<input type="password" placeholder="请输入密码" placeholder-style="color:#999" v-model="password_confirm"/>
			</view>
			<view class="sureBtn" @click="suresubmit">确定</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				type:1,//1忘记登录密码  2修改登录密码
				password:'',
				password_confirm:'',
				phone:'',
				code:''
			}
		},
		onLoad(options) {
			if(options.type){
				this.type = options.type || this.$route.query.type
			}
			if(options.code){
				this.code = options.code || this.$route.query.code
			}
			this.phone = options.phone || this.$route.query.phone
		},
		methods:{
			suresubmit(){
				this.request('/member/findPassword',{
					password:this.password,
					password_confirm:this.password_confirm,
					phone:this.phone,
					code:this.code
				}).then(res => {
					if(res.data.code==1){
						this.$tip(res.data.msg)
						setTimeout(()=>{
							uni.navigateBack()
						},500)
					}else{
						this.$tip(res.data.msg)
					}	
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.fgpassword{
		overflow: hidden;
		height: 100%;
		/deep/ .head{
			border-bottom: 2rpx solid #f5f5f5;
		}
		.content{
			padding: 0 10%;
			.itemList{
				display: flex;
				align-items: center;
				overflow: hidden;
				border-bottom: 2rpx solid rgba(238,238,238,1);
				height: 70rpx;
				margin-top: 60rpx;
				view{
					width: 180rpx;
				}
				input{
				  width: calc(100% - 148rpx);
				  height: 80%;
				  margin-top: 2rpx;
				}
			}
			.sureBtn{
				height: 90rpx;
				line-height: 90rpx;
				text-align: center;
				background: $uni-item-color;
				margin-top: 54rpx;
				color: #fff;
			}
		}
	}
</style>
